package com.syni.mdd.sjb.common.datatreaure.controller.protect.dataTreasure.saasminapp;

import com.syni.mdd.sjb.common.component.utils.common.annotations.CheckUserIdentity;
import com.syni.mdd.sjb.common.datatreaure.controller.BaseController;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rq.databank.MemberRqVo;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rq.saasminapp.config.StoreIdVo;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rq.saasminapp.order.*;
import com.syni.mdd.sjb.common.datatreaure.service.databank.saasminapp.MinOrderService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


@RestController
@RequestMapping("/minApp/order")
public class MinOrderController extends BaseController {

    @Autowired
    private MinOrderService minOrderService;

    @PostMapping("/getDelivery")
    @ApiOperation(value = "查询已开通配送方式")
    @CheckUserIdentity
    public Map<String,Object> getDelivery(@RequestBody MemberRqVo memberRqVo){
        return minOrderService.getDelivery(memberRqVo);
    }

    @PostMapping("/getOrderByPage")
    @ApiOperation(value = "分页获取订单列表")
    @CheckUserIdentity
    public Map<String,Object> getOrderByPage(@RequestBody GetOrderListVo getOrderListVo){
        return minOrderService.getOrderByPage(getOrderListVo);
    }

    @PostMapping("/getOrderDetail")
    @ApiOperation(value = "查询订单详情")
    @CheckUserIdentity
    public Map<String,Object> getOrderDetail(@RequestBody GetOrderDetailVo getOrderDetailVo){
        return minOrderService.getOrderDetail(getOrderDetailVo);
    }

    @PostMapping("/cancelOrder")
    @ApiOperation(value = "取消订单")
    @CheckUserIdentity
    public Map<String,Object> cancelOrder(@RequestBody GetOrderDetailVo getOrderDetailVo){
        return minOrderService.cancelOrder(getOrderDetailVo);
    }

    @PostMapping("/deleteOrder")
    @ApiOperation(value = "删除订单")
    @CheckUserIdentity
    public Map<String,Object> deleteOrder(@RequestBody GetOrderDetailVo getOrderDetailVo){
        return minOrderService.deleteOrder(getOrderDetailVo);
    }

    @PostMapping("/completeOrder")
    @ApiOperation(value = "完成订单")
    @CheckUserIdentity
    public Map<String,Object> completeOrder(@RequestBody GetOrderDetailVo getOrderDetailVo){
        return minOrderService.completeOrder(getOrderDetailVo);
    }

    @PostMapping("/userHasPaid")
    @ApiOperation(value = "完成订单")
    @CheckUserIdentity
    public Map<String,Object> userHasPaid(@RequestBody GetOrderDetailVo getOrderDetailVo){
        return minOrderService.userHasPaid(getOrderDetailVo);
    }

    @PostMapping("/modifyPrice")
    @ApiOperation(value = "商家改价")
    @CheckUserIdentity
    public Map<String,Object> modifyPrice(@RequestBody ModifyPriceVo modifyPriceVo){
        return minOrderService.modifyPrice(modifyPriceVo);
    }

    @PostMapping("/printTicket")
    @ApiOperation(value = "打印小票")
    @CheckUserIdentity
    public Map<String,Object> printTicket(@RequestBody PrintTicketVo printTicketVo){
        return minOrderService.printTicket(printTicketVo);
    }

    @PostMapping("/removeOrderItem")
    @ApiOperation(value = "移除订单项")
    @CheckUserIdentity
    public Map<String,Object> removeOrderItem(@RequestBody GetOrderDetailVo getOrderDetailVo){
        return minOrderService.removeOrderItem(getOrderDetailVo);
    }

    @PostMapping("/netShop")
    @ApiOperation(value = "商家发货/重新派单")
    @CheckUserIdentity
    public Map<String,Object> netShop(@RequestBody NetShopVo netShopVo){
        return minOrderService.netShop(netShopVo);
    }

    @PostMapping("/getDadaComplaintReasons")
    @ApiOperation(value = "获取达达的投诉原因")
    @CheckUserIdentity
    public Map<String,Object> getDadaComplaintReasons(@RequestBody StoreIdVo storeIdVo){
        return minOrderService.getDadaComplaintReasons(storeIdVo);
    }

    @PostMapping("/complaintDada")
    @ApiOperation(value = "投诉达达")
    @CheckUserIdentity
    public Map<String,Object> complaintDada(@RequestBody ComplainDadaVo complainDadaVo){
        return minOrderService.complaintDada(complainDadaVo);
    }

    @PostMapping("/dadaCancelReasons")
    @ApiOperation(value = "获取达达的取消运单原因")
    @CheckUserIdentity
    public Map<String,Object> dadaCancelReasons(@RequestBody StoreIdVo storeIdVo){
        return minOrderService.dadaCancelReasons(storeIdVo);
    }

    @PostMapping("/cancelDadaDelivery")
    @ApiOperation(value = "取消达达的运单")
    @CheckUserIdentity
    public Map<String,Object> cancelDadaDelivery(@RequestBody CancelDeleveryVo cancelDeleveryVo){
        return minOrderService.cancelDadaDelivery(cancelDeleveryVo);
    }

    @PostMapping("/confirmGoods")
    @ApiOperation(value = "达达物品返回确认")
    @CheckUserIdentity
    public Map<String,Object> confirmGoods(@RequestBody CancelDeleveryVo cancelDeleveryVo){
        return minOrderService.confirmGoods(cancelDeleveryVo);
    }

    @PostMapping("/messageConfirm")
    @ApiOperation(value = "商家回应达达骑手取消订单")
    @CheckUserIdentity
    public Map<String,Object> messageConfirm(@RequestBody MessageConfirmVo messageConfirmVo){
        return minOrderService.messageConfirm(messageConfirmVo);
    }

    @PostMapping("/confirmArrived")
    @ApiOperation(value = "自配送商家确认送达")
    @CheckUserIdentity
    public Map<String,Object> comfrimArrived(@RequestBody MessageConfirmCopyVo messageConfirmCopyVo){
        return minOrderService.comfrimArrived(messageConfirmCopyVo);
    }

    @PostMapping("/pickedUp")
    @ApiOperation(value = "商家确认自提订单已取货")
    @CheckUserIdentity
    public Map<String,Object> pickedUp(@RequestBody MessageConfirmCopyVo messageConfirmCopyVo){
        return minOrderService.pickedUp(messageConfirmCopyVo);
    }

    @PostMapping("/getTmplServiceList")
    @ApiOperation(value = "获取服务套餐列表")
    @CheckUserIdentity
    public Map<String,Object> getTmplServiceList(@RequestBody StoreIdVo storeIdVo){
        return minOrderService.getTmplServiceList(storeIdVo);
    }

    @PostMapping("/buyServicePrepay")
    @ApiOperation(value = "获取购买服务的支付参数")
    @CheckUserIdentity
    public Map<String,Object> buyServicePrepay(@RequestBody BuyServicePrepayVo buyServicePrepayVo){
        return minOrderService.buyServicePrepay(buyServicePrepayVo);
    }


}
